package com.xywy.bloodandroid.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * *****************************************
 * 
 * @Title: Constants.java
 * @Package com.xywy.maternalandchildandroid.util
 * @Description: TODO(基本信息)
 * @author smz
 * @date 2014-12-11 下午1:51:04
 * @version V1.0
 ******************************************* 
 */
public class Constants {
	public static final int ALB_UM = 2019;// 相册
	public static final int PHOTO_GRAPH = 2020;// 拍照

	public static String Sign = "KHy69gsk8%#@kl$";// 数字签名验证
	public static String tag = "BloodAndroid";

	public static boolean wight_flag = true;// 控制popwindow的开关
	public static boolean height_flag = true;// 控制popwindow的开关

	public static String imgUrl = "http://api.wws.xywy.com/upload.php?";// 上传图片的地址

	public static String url = "http://api.wws.xywy.com/index.php?";

	public static String wjkTag = "wjk";
	

	public static final String NAME_MATCH = "^[\u4E00-\u9FA5]{2,8}$";// 2至8个汉字的
	public static final String PHONE_MATCH = "^1[0-9]{10}$";// 手机号正则

	public static final String PASSWORD = "^[0-9a-zA-Z]{6,16}$";
	private static SharedPreferences sp;
	// 血压咨询
	public static final String BP_NEWS_URL = "http://api.wws.xywy.com/index.php?act=zixun&fun=getHealthPlazeList&version=version2";
	public static final String BP_NEWS_DETAIL_URL = "http://api.wws.xywy.com/index.php?act=zixun&fun=getHealthPlazeDetail&version=version2";
	public static final String TAG = "zj";
	public static final String KEY = "KHy69gsk8%#@kl$";
	
	public static final String IsCOllection_url="http://api.yun.xywy.com/index.php/glu_app/collect/post/?"+"&tag="+tag;
	public static final String getCOllection_url="http://api.yun.xywy.com/index.php/glu_app/collect/list_data/?";
	public static final String COllection_url="http://api.yun.xywy.com/index.php/glu_app/" +
			"collect/is_collected/?"+"&tag="+tag;
	/**
	 * 资讯文章列表接口
	 * 
	 * @return url
	 * host 
	 */
	public static String getArticleListUrl(String host) {

		try {
			String sign = MD5.md5s(KEY + TAG);
			return  host+ "&tag=" + TAG + "&sign=" + sign;

		} catch (Exception e) {
			e.printStackTrace();
			return "-100";
		}

	}

	/**
	 * 获取请求的url的拼接
	 * 
	 */
	public static String getSendImgUrl() {

		try {
			String sign = MD5.md5s(Sign + tag);
			// 上传图片的
			return imgUrl + "&tag=" + tag + "&sign=" + Sign;

		} catch (Exception e) {
			e.printStackTrace();
			return "-100";
		}

	}

	/**
	 * 除了user 外 统一的 文件存储
	 * 
	 * @param context
	 * @return
	 */
	public static SharedPreferences getSp(Context context) {
		sp = context.getSharedPreferences("xywy_blood.pre",
				Context.MODE_PRIVATE);
		return sp;
	};

	/**
	 * 获取请求的url的拼接
	 * 
	 * @return
	 */
	public static String getUrl(String act, String fun) {

		try {
			String sign = MD5.md5s(Sign + tag);

			return url + "&tag=" + tag + "&sign=" + sign + "&act=" + act
					+ "&fun=" + fun;

		} catch (Exception e) {
			e.printStackTrace();
			return "-100";
		}

	}

	/**
	 * 提交图片
	 * 
	 * @return
	 */
	public static String getImageUrl() {
		String sign;
		try {
			sign = MD5.md5s(Sign + tag);
			return "http://api.wws.xywy.com/upload.php?" + "&tag=" + tag
					+ "&sign=" + sign;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "";
		}
	}

	/**
	 * 是否是第一次登录
	 * 
	 * @param context
	 * @return false不是第一次登录 true is first
	 */
	public static boolean isLogin(Context context) {
		sp = getSp(context);
		if (getFlagValue(context) == -2) {
			return false;
		} else {
			return true;
		}
	}

	/**
	 * 获取保存的值
	 * 
	 * @param context
	 * @return
	 */
	public static int getFlagValue(Context context) {
		sp = getSp(context);
		int flag = sp.getInt("login_FLAG", -1);
		return flag;
	}

	/**
	 * 设置 是否是第一次登录
	 * 
	 * @param context
	 * @param value
	 */
	public static void setFlagValue(Context context, int value) {
		sp = getSp(context);
		sp.edit().putInt("login_FLAG", value).commit();
	}
	
	
	public static ArrayList<String> province = new ArrayList<String>();
	public static Map<Integer, String> profession_info = new HashMap<Integer, String>();
	public static ArrayList<String> profession = new ArrayList<String>();
	
	public static ArrayList<String> Testslot = new ArrayList<String>();
	static{
		province.add("不限");
		province.add("北京市");
		province.add("山东省");
		province.add("山西省");
		province.add("河北省");
		province.add("河南省");
		province.add("天津市");
		province.add("辽宁省");
		province.add("黑龙江省");
		province.add("吉林省");
		province.add("湖北省");
		province.add("湖南省");
		province.add("上海市");
		province.add("四川省");
		province.add("重庆市");
		province.add("陕西省");
		province.add("甘肃省");
		province.add("云南省");
		province.add("新疆维吾尔自治区");
		province.add("内蒙古自治区");
		province.add("海南省");
		province.add("贵州省");
		province.add("青海省");
		province.add("广东省");
		province.add("宁夏回族自治区");
		province.add("西藏自治区");
		province.add("广西壮族自治区");
		province.add("江苏省 ");
		province.add("浙江省");
		province.add("安徽省");
		province.add("江西省");
		province.add("福建省");

		profession_info.put(1, "主任医师");
		profession_info.put(2, "副主任医师");
		profession_info.put(3, "主治医师");
		profession_info.put(5, "医师");// 医师 就是 住院医师

		profession.add("不限");
		profession.add("主任医师");
		profession.add("副主任医师");
		profession.add("主治医师");
		profession.add("医师");
		
		Testslot.add("凌晨(空腹)");
		Testslot.add("早餐后");
		Testslot.add("午餐前");
		Testslot.add("午餐后");
		Testslot.add("晚餐前");
		Testslot.add("晚餐后");
		
	}
}
